<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">
    
    <h:head>
        <title>Meteocal | Import</title>
        <h:outputStylesheet name="css/style.css" />
    </h:head>
    
    <h:body>
        <div id="container">
            
            <div id="sidebar">
                <h:form>
                    <p:poll interval="15" listener="#{notificationCheckBean.check()}" />
                    <p:menu model="#{menuBean.model}" style="min-height: 615px;"/>
                </h:form>                      
            </div>

            <div id="content">
               <h:form enctype="multipart/form-data">
                 <p:growl id="messages"  life="7000" showDetail="true" globalOnly="true" autoUpdate="true"/>
                 <p:panel styleClass="default" style="min-height: 600px;">
                     <h:panelGrid columns="2">
                        <p:outputLabel value="Number of your events:  " style="font-style: italic"/>
                        <p:outputLabel value="#{expimpBean.nevents}"/>
                        <p:outputLabel value="Number of your participations: " style="font-style: italic"/>
                        <p:outputLabel value="#{expimpBean.nparts}"/>
                     </h:panelGrid>     
                     <p:fileUpload label="Choose file backup"   value="#{expimpBean.importFile}"  mode="simple"/>
                     
                     <h:panelGrid columns="3">
                        <p:outputLabel value="Import user data + calendar privacy" style="font-style: italic"/>
                        <p:selectBooleanCheckbox value="#{expimpBean.usercal}"></p:selectBooleanCheckbox>
                        <br/>
                        <p:outputLabel value="Import event + my participations " style="font-style: italic"/>
                        <p:selectBooleanCheckbox value="#{expimpBean.eventpart}">
                             <p:ajax update="drop,check" />
                        </p:selectBooleanCheckbox>
                        <p:outputLabel  rendered="true" style="font-size:11px; color: lightskyblue; font-style: italic" value="only events and participations that are present today in your calendar will be updated" />
                        <p:outputLabel value="Delete all events from your calendar before importing" style="font-style: italic"/>
                        <p:selectBooleanCheckbox id="drop" disabled="#{!expimpBean.eventpart || expimpBean.addunknown}" value="#{expimpBean.dropp}">
                             <p:ajax update="check,report" />
                        </p:selectBooleanCheckbox>
                        <p:outputLabel rendered="true" style="font-size:11px; color: lightskyblue; font-style: italic" value="before importing all events will be eliminated with them partcipations. any related notifications will be cleared. Full import from the archive" />
                        <p:outputLabel value="Add events today not present in your calendar " style="font-style: italic"/>
                        <p:selectBooleanCheckbox  id="check" disabled="#{!expimpBean.eventpart || expimpBean.dropp}"  value="#{expimpBean.addunknown}">
                             <p:ajax update="report,drop" />
                        </p:selectBooleanCheckbox>
                        <p:outputLabel rendered="true" style="font-size:11px; color: lightskyblue; font-style: italic" value="will add events that are not present today in your calendar with related participations and new notifications" />
                        <p:commandButton value="Import"  icon="ui-icon-arrowthickstop-1-s" ajax="false" oncomplete="" actionListener="#{expimpBean.importCalendar()}"  />
                     </h:panelGrid>  
                     
                     
                     <h:panelGrid   id="report" columns="2">
                         <p:outputLabel rendered="#{expimpBean.addunknown ||expimpBean.dropp}" value="Number of new events: " style="font-style: italic"/>
                         <p:outputLabel rendered="#{expimpBean.addunknown|| expimpBean.dropp}" value="#{expimpBean.evecreate}"/>
                         <p:outputLabel rendered="#{expimpBean.addunknown || expimpBean.dropp}" value="Number of new invitations to other users: " style="font-style: italic"/>
                         <p:outputLabel rendered="#{expimpBean.addunknown || expimpBean.dropp}" value="#{expimpBean.partcreate}"/>
                     </h:panelGrid>    
                 </p:panel>
                </h:form>
            </div>

        </div>
    </h:body>
</html>